From: Ewan Mellor Date: Fri, 23 Mar 2007 11:00:08 +0000 (+0000) Subject: Fix xenapi_create re: Multiple VIFs for test 04_restore_withdevices_pos X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15277^2~25 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=a24516689ff0ccb40624a58724c05e8bc24fd930;p=xen.git Fix xenapi_create re: Multiple VIFs for test 04_restore_withdevices_pos Signed-off-by: Tom Wilkie --- diff --git a/tools/python/xen/xm/xenapi_create.py b/tools/python/xen/xm/xenapi_create.py index d4cdb4870f..dd7f607051 100644 --- a/tools/python/xen/xm/xenapi_create.py +++ b/tools/python/xen/xm/xenapi_create.py @@ -611,7 +611,10 @@ class sxp2xml: vif = document.createElement("vif") - dev = get_child_by_name(vif_sxp, "vifname", "eth0") + dev = get_child_by_name(vif_sxp, "vifname", None) + + if dev is None: + dev = self.getFreshEthDevice() vif.attributes["name"] \ = "vif" + str(dev.__hash__()) @@ -628,7 +631,8 @@ class sxp2xml: return vif + _eths = -1 - - - + def getFreshEthDevice(self): + self._eths += 1 + return "eth%i" % self._eths